package com.xunqi.pay.enums;

import com.lly835.bestpay.enums.BestPayTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description:
 * @Created: with IntelliJ IDEA.
 * @author: 夏沫止水
 * @createTime: 2020-05-11 17:54
 **/

@Getter
@AllArgsConstructor
public enum PayPlatformEnum {

    //1-支付平台:1-支付宝,2-微信
    ALIPAY(1),

    WX(2),
    ;

    private Integer code;


    public static PayPlatformEnum getBestPlayFormEnum(BestPayTypeEnum bestPayTypeEnum) {

        for (PayPlatformEnum payPlatformEnum : PayPlatformEnum.values()) {
            if (bestPayTypeEnum.getPlatform().name().equals(payPlatformEnum.name())) {
                return payPlatformEnum;
            }
        }
        throw new RuntimeException("错误的支付平台: " + bestPayTypeEnum.name());
    }

}
